//
//  UIButton+Extension.swift
//  MLWeiBo
//
//  Created by wenxing on 2017/1/5.
//  Copyright © 2017年 Se7venX. All rights reserved.
//

import UIKit


extension UIButton {

    
    /// 按钮
    convenience init(title:String = "",fontSize:CGFloat = 0,titleColor:UIColor,imageName:String,hightImageName:String){
        
        self.init()
        
        self.setTitle(title, for: .normal)
        self.setTitleColor(titleColor, for: .normal)
        
        if fontSize > 0 {
            
            self.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
        }
        
        
        self.setImage(UIImage(named: imageName), for: .normal)
        self.setImage(UIImage(named: hightImageName), for: .highlighted)
        
    }
    
    
    /// 测试
    convenience init(title:String = "",fontSize:CGFloat = 0,titleColor:UIColor = UIColor.black,imageName:String = "",hightImageName:String = "",backgroundImageName:String = ""){
        
        self.init()
        
        self.setTitle(title, for: .normal)
        self.setTitleColor(titleColor, for: .normal)
        
        if fontSize > 0 {
            
            self.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
        }
        
        self.setImage(UIImage(named: imageName), for: .normal)
        self.setImage(UIImage(named: hightImageName), for: .highlighted)
        self.setBackgroundImage(UIImage(named: backgroundImageName), for: .normal)
    }
}
